<template>
	<view>
		<uni-collapse accordion="true">
			<uni-collapse-item class="big" title="大赛" showAnimation thumb="../../static/bisai.png">
				<!-- 增加全国大赛 -->
				<plusMatch @func="getMatchfromSon"></plusMatch>
				<!-- 删除全国大赛 -->
				<delectMatch :message="matchList" @func="delectMatchFromSon"></delectMatch>
				<!-- 增加全国大赛通知 -->
				<plusNotice @func="getNoticefromSon"></plusNotice>
				<!-- 删除全国大赛通知 -->
				<deleteNotice :message="noticeList" @func="getNoticeListfromSon"></deleteNotice>
				<!-- 增加管理员通知 -->
				<!-- <plusMnotice @func ="getMnoticefromSon"></plusMnotice> -->
				<!-- 修改管理员通知 -->
				<deleteMnotice :message="mnoticeListM" @func="getMnoticeListfromSon"></deleteMnotice>
				<!-- 增加比赛 -->
				<uni-collapse accordion="true">
					<uni-collapse-item title="增加比赛项目" thumb="../../static/zengjia.png">
						<view class="uni-list-cell-left">
							点击选择大赛：
						</view>
						<view class="uni-list-cell-db">
							<picker @change="bindPicker" :value="index" :range="matchList" range-key="title">
								<view class="uni-input" style="color: red; text-align: center;width: 100%;margin: 0 auto;
							 line-height: 23px;border:1px solid #CCC ;">
							 选择：{{matchList[index]==""||matchList[index]==null?"请点击选择":matchList[index].title}}</view>
							</picker>
						</view>
						<view style="padding-left: 20px;" class="title">设置项目名称：
							<input type="text" value="" placeholder="例如:竞速飞行" @input="name" />
						</view>
						<view style="padding-left: 20px;" class="title">设置大赛成绩类型：
							<!-- <view style="color: red; font-size: 10px;">1代表以分数记分(100); 2代表以时间记分(00:09:30); 3代表以胜负记分(胜/负)</view> -->
							<!-- <input type="text" value="" placeholder="请输入数字1/2/3" @input="gradeType"/> -->
							<view class="uni-list-cell-db">
								<picker @change="gradeType" :value="index" :range="gradeTypeList" range-key="grade">
									<view class="uni-input" style="color: red; text-align: center;width: 55%;margin: 0 auto;
								 line-height: 23px;border:1px solid #CCC ;">点击选择：{{gradeTypeList[n].grade}}</view>
								</picker>
							</view>
						</view>
						<view style="padding-left: 20px;" class="title">设置比赛类型：
							<!-- <input type="text" value="" placeholder="请输入1/2" @input="isGroup"/> -->
							<view class="uni-list-cell-db">
								<picker @change="isGroup" :value="index" :range="groupTypeList" range-key="group">
									<view class="uni-input" style="color: red; text-align: center;width: 55%;margin: 0 auto;
								 line-height: 23px;border:1px solid #CCC ;">点击选择：{{groupTypeList[m].group}}</view>
								</picker>
							</view>
						</view>
						<!-- <view style="padding-left: 20px;padding-bottom: 15px;" class="title">设置项目编码(若该项目属于团体项目请设置)：
							<input type="text" value="" placeholder="请输入团体码" @input="gruopCode" />
						</view> -->
						<button @click="wancheng">增加</button>
					</uni-collapse-item>
				</uni-collapse>
				<!-- 删除比赛 -->
				<uni-collapse accordion="true">
					<uni-collapse-item title="删除比赛项目" thumb="../../static/shanchu.png">
						<deleteProjects :message="matchList" @func="comList"></deleteProjects>
						<view class="uni-list">
							<view class="uni-list-cell" style="display: inline-block;padding-left: 0;">
								<view class="uni-list-cell-left">
									选择需要删除的项目：
								</view>
								<view class="uni-list-cell-db">
									<picker @change="bps" :value="index" :range="projectList" range-key="name">
										<view v-if="isShow" class="uni-input" style="text-align: center;width: 100%;margin: 0 auto; line-height: 23px;border:1px solid #CCC ;">
											{{projectList[index].name}}</view>
									</picker>
								</view>
							</view>
						</view>
						<button @click="shanchu">删除</button>
					</uni-collapse-item>
				</uni-collapse>
				<!-- 生成证书 -->
				<getCertifical :message="matchList" @func="getCertificalFromSon"></getCertifical>
				<!-- 导出排行榜 -->
				<uni-collapse accordion="true">
					<uni-collapse-item title="下载排行榜" thumb="../../static/daochu.png">
						<deleteProjects :message="matchList" @func="downloadList"></deleteProjects>
						<view class="uni-list">
							<view class="uni-list-cell" style="display: inline-block;padding-left: 0;">
								<view class="uni-list-cell-left">
									选择项目：
								</view>
								<view class="uni-list-cell-db">
									<picker @change="bps" :value="index" :range="projectList" range-key="name">
										<view v-show="isShow" class="uni-input" style="color: red; text-align: center;width: 100%;margin: 0 auto; line-height: 23px;border:1px solid #CCC ;">
											{{projectList[index]=="" || projectList[index]==null?"请点击选择":projectList[index].name}}</view>
									</picker>
								</view>
							</view>
						</view>
						<view style="padding-left: 12px;padding-bottom: 10px;" class="title">请选择组别：
							<!-- <input style="width:78%;height:50px;" type="text" value="" placeholder="请输入组别 例如:小学" @input="groupT"/> -->
							<view class="uni-list-cell-db">
								<picker @change="groupT" :value="index" :range="array" range-key="name">
									<view class="uni-input" style="color: red; text-align: center;width: 55%;margin: 0 auto;
									 line-height: 23px;border:1px solid #CCC ;">点击选择：{{array[o].name}}</view>
								</picker>
							</view>
						</view>
						<!-- <input v-if="flag" type="text" :value="gUrl" /> -->
						<button @click="xiazai">下载</button>
						<view class="uni-textarea">
							<!-- <textarea :value="gUrl" style="width:100%;height:100px;padding:0;text-align:center;"/> -->
							<input :value="gUrl" style="width:90%;height:50px;"/>
						</view>
					</uni-collapse-item>
				</uni-collapse>
				<!-- 下载大赛报名表 -->
				<uni-collapse accordion="true">
					<uni-collapse-item title="下载大赛报名表" thumb="../../static/daochu.png">
						<!-- <input style="text-align: center;width:78%;height:50px;" type="text" :value="url" placeholder="点击下方标题,复制并打开浏览器" /> -->
						<view class="uni-textarea">
							<input :value="url" style="width:90%;height:50px;"/>
							<!-- <textarea :value="url" style="width:100%;height:100px;padding:0;text-align:center;"/> -->
						</view>
						<button v-for="item in matchList" :key="item.id" @click="dbaoming(item.id)">{{item.title}}</button>
					</uni-collapse-item>
				</uni-collapse>
				
				<!-- 查询大赛id -->
				<uni-collapse accordion="true">
					<uni-collapse-item title="查询大赛id" thumb="../../static/daochu.png">
						<view v-for="item in competitionList" :key="item.id">id: {{item.id}} 名称: {{item.title}}</view>
					</uni-collapse-item>
				</uni-collapse>
				
				<!--颁发全国大赛证书-->
				<uni-collapse accordion="true">
					<uni-collapse-item title="给学生颁发全国大赛证书" thumb="../../static/chengji.png">
						
						<view style="padding-left: 20px;" class="title">几等奖：
							<input type="text" value="" placeholder="请输入数字,如1" @input="idengji" />
						</view>
						<view style="padding-left: 20px;" class="title">大赛id：
							<input type="text" value="" placeholder="请输入输入大赛id" @input="idasai" />
						</view>
						<view style="padding-left: 20px;" class="title">组别，输入(小学，初中，高中，大学，附加)：
							<input type="text" value="" placeholder="请输入组别" @input="izubie" />
						</view>
						<view style="padding-left: 20px;padding-bottom: 15px;" class="title">输入学生电话号码：
							<input type="text" value="" placeholder="请输入学生电话号码" @input="iuserPhone" />
						</view>
						<view style="padding-left: 20px;padding-bottom: 15px;" class="title">输入项目名：
							<input type="text" value="" placeholder="项目名" @input="iproject" />
						</view>
						<view style="padding-left: 20px;padding-bottom: 15px;" class="title">输入辅导老师：
							<input type="text" value="" placeholder="请输入辅导老师" @input="itutor" />
						</view>
						<button @click="banfadasai">完成</button>
					</uni-collapse-item>
				</uni-collapse>
				
			</uni-collapse-item>
			<uni-collapse-item class="big" title="考试" showAnimation thumb="../../static/kaoshi.png">
				<!-- 增加等级考试 -->
				<plusLeaveExam @func="plusLeaveExamList"></plusLeaveExam>
				<!-- 删除等级考试 -->
				<deleteExam :message="examList" @func="getExamFromSon"></deleteExam>
				<!-- 关闭等级考试 -->
				<closeExam :message="examList" @func="getExamListfromSon"></closeExam>
				<!-- 颁发等级证书 -->
				<uni-collapse accordion="true">
					<uni-collapse-item title="给学生颁发等级考试证书" thumb="../../static/chengji.png">
						<!-- <deleteProjects :message="matchList" @func="comList"></deleteProjects> -->
						<view class="uni-list">
							<view class="uni-list-cell" style="display: inline-block;padding-left: 0;">
								<view class="uni-list-cell-left">
									点击选择比赛：
								</view>
								<view class="uni-list-cell-db">
									<picker @change="bindPickerChange" :value="index" :range="examList" range-key="title">
										<view class="uni-input" style="color: red; text-align: center;width: 100%;margin: 0 auto; line-height: 23px;border:1px solid #CCC ;">
											{{examList[index]==""||examList[index]==null?"请点击选择":examList[index].title}}</view>
									</picker>
								</view>
							</view>
						</view>
						<view style="padding-left: 20px;" class="title">输入监考老师姓名：
							<input type="text" value="" placeholder="请输入监考老师姓名" @input="iName" />
						</view>
						<view style="padding-left: 20px;" class="title">输入评审老师姓名：
							<input type="text" value="" placeholder="请输入评审老师姓名" @input="jName" />
						</view>
						<view style="padding-left: 20px;" class="title">输入辅导老师姓名：
							<input type="text" value="" placeholder="请输入辅导老师姓名" @input="tName" />
						</view>
						<view style="padding-left: 20px;padding-bottom: 15px;" class="title">输入学生电话号码：
							<input type="text" value="" placeholder="请输入学生电话号码" @input="sPhone" />
						</view>
						<button @click="banfa">完成</button>
					</uni-collapse-item>
				</uni-collapse>
	
				
				<!-- 下载等级考试报名结果 -->
				<uni-collapse accordion="true">
					<uni-collapse-item title="下载等级考试结果" thumb="../../static/daochu.png">
						<!-- <input style="text-align: center;width:78%;height:50px;" type="text" :value="url" placeholder="点击下方标题,复制并打开浏览器" /> -->
						<view class="uni-textarea">
							<!-- <textarea :value="rurl" style="width:100%;height:100px;padding:0;text-align:center;" /> -->
							<input :value="rurl" style="width:90%;height:50px;"/>
						</view>
						<button v-for="item in examList" :key="item.id" @click="dresult(item.id)">{{item.title}}</button>
					</uni-collapse-item>
				</uni-collapse>
				<!-- 导出等级考试报名表 -->
				<uni-collapse accordion="true">
					<uni-collapse-item title="下载等级考试报名表" thumb="../../static/daochu.png">
						<!-- <input style="text-align: center;width:78%;height:50px;" type="text" :value="url" placeholder="点击下方标题,复制并打开浏览器" /> -->
						<view class="uni-textarea" v-if="isLook">
							<!-- <textarea :value="turl" style="width:100%;height:100px;padding:0;text-align:center;"/> -->
							<input :value="turl" style="width:90%;height:50px;"/>
						</view>
						<button v-for="item in examList" :key="item.id" @click="download(item.id)">{{item.title}}</button>
					</uni-collapse-item>
				</uni-collapse>
			</uni-collapse-item>
			<uni-collapse-item class="big" title="题库" showAnimation thumb="../../static/tiku.png">
				<!-- 查询题库 -->
				<uni-collapse accordion="true">
					<uni-collapse-item title="查询题库" thumb="../../static/chaxun.png">
						<input style="text-align: center;width:78%;height:50px;" type="text" value="" placeholder="请输入想要查询的题库号" @input="number" />
						<button @click="query">查询</button>
					</uni-collapse-item>
				</uni-collapse>
				<!-- 增加题库的题目 -->
				<plusQuestion @func="pQuestion"></plusQuestion>
				<!-- 删除题库里的题目 -->
				<uni-collapse accordion="true">
					<uni-collapse-item title="删除题库的题目" thumb="../../static/shanchu.png">
						<view class="uni-list">
							<view class="uni-list-cell" style="display: inline-block;padding-left: 0;">
								<input type="text" value="" placeholder="请输入题库号" @input="number" />
								<!-- <button @click="query">查询</button> -->
								<view class="uni-list-cell-left" style="color: red;">
									选择需要删除的题目：
								</view>
								<view class="uni-list-cell-db">
									<picker @change="bindChange" :value="index" :range="qList" range-key="stem">
										<view class="uni-input" style="text-align: center;width: 100%;margin: 0 auto;
										 line-height: 23px;border:1px solid #CCC ;">{{qList[index]==""||qList[index]==null?"请点击选择":qList[index].stem}}</view>
									</picker>
								</view>
							</view>
						</view>
						<button @click="dq">删除</button>
					</uni-collapse-item>
				</uni-collapse>
				<!-- 查询考试配置 -->
				<!-- <uni-collapse accordion="true">
			    <uni-collapse-item title="查询考试配置" thumb="../../static/chaxun.png">
					<button @click="queryEp">查询考试配置</button>
			    </uni-collapse-item>
			</uni-collapse> -->
				<!-- 配置某场考试题目数量 -->
				<uni-collapse accordion="true">
					<uni-collapse-item title="增加某场等级考试考题数量配置(最少为2题)" thumb="../../static/peizhi.png">
						<view class="uni-list">
							<view class="uni-list-cell" style="display: inline-block;padding-left: 0;">
								<view class="uni-list-cell-left">
									选择需要配置的考试项目：
								</view>
								<view class="uni-list-cell-db">
									<picker @change="bindPickerChange" :value="index" :range="examList" range-key="title">
										<view class="uni-input" style="color: red; text-align: center;width: 100%;margin: 0 auto;
										 line-height: 23px;border:1px solid #CCC ;">选择：
											{{examList[index]==""||examList[index]==null?"请点击选择":examList[index].title}}</view>
									</picker>
								</view>
								<input type="text" value="" placeholder="请输入题目总数 例如:2" @input="number" />
							</view>
						</view>
						<button @click="pCount">完成</button>
					</uni-collapse-item>
				</uni-collapse>
				<!-- 配置整个题库考试题目分数 -->
				<uni-collapse accordion="true">
					<uni-collapse-item title="统一配置题库题目每题分数" thumb="../../static/peizhi.png">
						<view class="uni-list">
							<view class="uni-list-cell" style="display: inline-block;padding-left: 0;">
								<input type="text" value="" placeholder="请输入想要设置的考试题库号" @input="bankNum" />
								<input type="text" value="" placeholder="请输入考题总分数 例如:100" @input="allScore" />
							</view>
						</view>
						<button @click="complete">完成</button>
					</uni-collapse-item>
				</uni-collapse>
				<!-- 配置单个考试题目分数 -->
				<uni-collapse accordion="true">
					<uni-collapse-item title="配置单个题目分数" thumb="../../static/peizhi.png">
						<view class="uni-list">
							<view class="uni-list-cell" style="display: inline-block;padding-left: 0;">
								<input type="text" value="" placeholder="请输入题库号" @input="number" />
								<view class="uni-list-cell-left" style="color: red;">
									选择需要配置分数的题目：
								</view>
								<view class="uni-list-cell-db">
									<picker @change="pickerChange" :value="index" :range="qList" range-key="stem">
										<view class="uni-input" style="text-align: center;width: 100%;margin: 0 auto;
										 line-height: 23px;border:1px solid #CCC ;">{{qList[index]==""||qList[index]==null?"请点击选择":qList[index].stem}}</view>
									</picker>
								</view>
								<input style="padding-bottom: 15px;" type="text" value="" placeholder="请输入分值 例如:10" @input="ss" />
							</view>
						</view>
						<button @click="sscore">完成</button>
					</uni-collapse-item>
				</uni-collapse>
				<!-- 删除考试题目不写 -->
			</uni-collapse-item>
			<uni-collapse-item class="big" title="更换图片" showAnimation thumb="../../static/peizhi.png">
				<uni-collapse accordion="true">
					<uni-collapse-item title="查询所有图片" thumb="../../static/chaxun.png">
						<button style="height: 45;padding: 8px;" @click="querytupian">查询所有图片</button>
					</uni-collapse-item>
				</uni-collapse>
			</uni-collapse-item>
			<!-- 查询题库 -->
			<uni-collapse-item class="big" title="权限和注册信息" showAnimation thumb="../../static/peizhi.png">
				<uni-collapse accordion="true">
					<uni-collapse-item title="设置管理员和老师" thumb="../../static/xiugai.png">
						<input style="text-align: center;width:78%;height:50px;" type="number" value="" placeholder="请输入手机号" @input="phoneNumber" />
						<input style="text-align: center;width:78%;height:50px;" type="number" value="" placeholder="请输入角色(管理员1 学生2 老师3)" @input="role" />
						<input style="text-align: center;width:78%;height:50px;color: red;" disabled="true" value="将该用户设置为管理员,设置后将不能更改" />
						<button @click="sure">确定</button>
					</uni-collapse-item>		
				</uni-collapse>
				
				<uni-collapse accordion="true">
					<uni-collapse-item title="下载学生,老师注册信息" thumb="../../static/daochu.png">
						<!-- <input style="text-align: center;width:78%;height:50px;" type="text" :value="url" placeholder="点击下方标题,复制并打开浏览器" /> -->
						<view class="uni-textarea">
							<!-- <textarea :value="rurl" style="width:100%;height:100px;padding:0;text-align:center;" /> -->
							<input :value="zhuceUrl" style="width:90%;height:50px;"/>
						</view>
						<button  @click="zhuce(2)">学生</button>
						<button  @click="zhuce(3)">老师</button>
					</uni-collapse-item>
				</uni-collapse>
				
			</uni-collapse-item>
		</uni-collapse>
		<!-- <simple-datetime-picker  @submit="onConfirm"></simple-datetime-picker> -->
	</view>
</template>

<script>
	//增加题目
	import plusQuestion from '../../components/plusQuestion/plusQuestion.vue'
	//删除科目
	import deleteProjects from '../../components/deleteProjects/deleteProjects.vue'
	//增加等级考试组件
	import plusLeaveExam from '../../components/plusLeaveExam/plusLeaveExam.vue'
	//获取图片组件
	import tupian from '../../components/tupian/tupian.vue'
	//删除通知组件
	import deleteNotice from '../../components/deleteNotice/deleteNotice.vue'
	//生成证书组件
	import getCertifical from '../../components/getCertifical/getCerticfical.vue'
	//关闭考试组件
	import closeExam from '../../components/closeExam/closeExam.vue'
	//删除比赛组件
	import delectMatch from '../../components/delectMatch/delectMatch.vue'
	//删除等级考试
	import deleteExam from '../../components/deleteExam/deleteExam.vue'
	//增加大赛组件
	import plusMatch from '../../components/plusMatch/plusMatch.vue'
	//增加通知组件  
	import plusNotice from '../../components/plusNotice/plusNotice.vue'
	import uniCollapse from '../../components/uni-collapse/uni-collapse.vue'
	import uniCollapseItem from '../../components/uni-collapse-item/uni-collapse-item.vue'
	import uniSection from '../../components/uni-section/uni-section.vue'
	import uniSwipeAction from '../../components/uni-swipe-action/uni-swipe-action.vue'
	import uniSwipeActionItem from '../../components/uni-swipe-action-item/uni-swipe-action-item.vue'
	//引入的接口
	import {
		plusMatchList,
		competitions,
		plus_notice,
		delectMatchList,
		notice,
		deleteNoticeList,
		exam,
		closeExamList,
		getCertificalList,
		downloadSign,
		plusExam,
		deleteExamj,
		projects,
		deleteProjectsList,
		signResult,
		signTable,
		pQuestionList,
		questionBank,
		deleteQuestion,
		configNum,
		queryConfig,
		cAllScore,
		singleScore,
		clearQuestion,
		pProjects,
		gradeUrl,
		banfaCerfict,
		deleteMnotice,
		giveAdmin,
		updataNotice,
		zhuce,
		banfadasai,
		allNationCompetition
	} from '../../apis'
	export default {
		data() {
			return {
				gradeTypeList: [{
					"grade": "分数"
				}, {
					"grade": "时间"
				}, {
					"grade": "胜负"
				}],
				groupTypeList: [{
					"group": "团体赛"
				}, {
					"group": "个人赛"
				}],
				array: [{
					"name": '小学组'
				}, {
					"name": '初中组'
				}, {
					"name": '高中组'
				}, {
					"name": '大学组'
				}, {
					"name": '附加组'
				}],
				url: '',
				rurl:'',
				turl:'',
				gUrl: '',
				isShow: false,
				matchList: [],
				index: -1,
				noticeList: [],
				noticeListM: [],
				mnoticeListM: [],
				projectList: [],
				comptionId: 1,
				projectsId: 1,
				matchId: '',
				examList: [],
				bankId: '',
				qList: [],
				questionId: '',
				examId: '',
				count: '',
				aScore: '',
				configList: [],
				gradeTypeInfo: '',
				gruopCodeInfo: '',
				isGroupInfo: '',
				nameInfo: '',
				groupTNum: 'XIAOXUE',
				flag: false,
				jkn: '',
				psn: '',
				fdn: '',
				snum: '',
				phone: '',
				n:0,
				m:0,
				o:0,
				isLook:false,
				zhuceUrl: '',
				dengji: '',
				dasai: '',
				zubie:'',
				userPhone:'',
				project:'',
				tutor:'',
				competitionList:[],
				myrole: 0
			}
		},
		onLoad() {
			//查询所有全国大赛
			allNationCompetition().then((res) => {
				let [err, data] = res
				this.competitionList = data.data.data
			}),
			//查询考试配置
			queryConfig().then((res) => {
					let [err, data] = res
					// console.log(data.data.data)
					this.configList = data.data.data
				}),
				//查询管理员备注
				notice({
					"type": "2"
				}).then((res) => {
					let [err, data] = res
					console.log("管理员备注" + data.data.data)
					this.mnoticeListM = data.data.data
				}),
				notice({
					"type": "3"
				}).then((res) => {
					let [err, data] = res
					console.log("管理员备注" + JSON.stringify(data.data.data))
					this.mnoticeListM.push(data.data.data[0])
					console.log("管理员备注数组：" + JSON.stringify(this.mnoticeListM))
				}),
				//查询首页大赛通知
				notice({
					"type": "1"
				}).then((res) => {
					let [err, data] = res
					console.log(data.data.data)
					this.noticeList = data.data.data
				}),
				//查询等级考试
				exam().then((res) => {
					let [err, data] = res
					console.log(data.data.data)
					this.examList = data.data.data
				}),
				//查询比赛
				competitions().then((res) => {
					let [err, data] = res
					console.log("大赛"+ JSON.stringify(data.data.data) )
					this.matchList = data.data.data
					// console.log("大赛-1为："+ this.matchList[-1] )
				})
				// 查询大赛id为1的项目
				// projects({
				// 	"competitionId": this.comptionId
				// }).then((res) => {
				// 	let [err, data] = res
				// 	console.log(data)
				// 	this.projectList = data.data.data
				// 	console.log("this.projectList为："+JSON.stringify(this.projectList) )
				// 	this.projectsId = this.projectList[this.index].id
				// })
				
		},
		methods: {
			role: function(e) {
				this.myrole = e.detail.value
			},
			zhuce(roleId) {				
				zhuce({
					"roleId": roleId
				}).then((res) => {
					let [err, data] = res
					if (data.data.code == 200) {
						this.zhuceUrl=data.data.data
					} else {
						uni.showToast({
							title: '获取失败！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			//通过手机号给用户分配管理员权限
			phoneNumber: function(e) {
				this.phone = e.detail.value
				console.log(this.phone)
			},
			sure() {
				console.log(this.phone)
				giveAdmin({
					"phone": this.phone,
					"roleId": this.myrole
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					if (data.data.code == 200) {
						uni.showToast({
							title: '权限分配成功',
							icon: 'success'
						})
					} else {
						uni.showToast({
							title: data.data.message,
							icon: 'none'
						})
					}
				})
			},
			//下载排行榜
			downloadList(data) {
				console.log("下载排行榜数据为：" + data)
				this.comptionId = this.matchList[data].id
				console.log("下载排行榜大赛id为：" + this.comptionId)
				this.isShow = true
				projects({
					"competitionId": this.matchList[data].id
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					this.projectList = data.data.data
					this.index = -1
					// console.log("this.projectList赛idddddf为：" + this.projectList[-1])
				})
			},
			//查询所有图片
			querytupian() {
				uni.navigateTo({
					url: '../queryAllTuPian/queryAllTuPian'
				})
			},
			//指定颁发全国大赛证书
			idengji:function(e) {
				this.dengji = e.detail.value
				console.log(this.jkn)
			},
			idasai:function(e) {
				this.dasai = e.detail.value
				console.log(this.jkn)
			},
			izubie:function(e) {
				this.zubie = e.detail.value
				console.log(this.jkn)
			},
			iuserPhone:function(e) {
				this.userPhone = e.detail.value
				console.log(this.jkn)
			},
			iproject:function(e) {
				this.project = e.detail.value
				console.log(this.jkn)
			},
			itutor:function(e) {
				this.tutor = e.detail.value
				console.log(this.jkn)
			},
			banfadasai(){
				console.log('手机号')
				console.log(this.userPhone)
				banfadasai({
					"awardsLeave": this.dengji,
					"competitonId":this.dasai,
					"gorupLeave":this.zubie,
					"phone":this.userPhone,
					"projectName":this.project,
					"tutor":this.tutor
				}).then((res) => {
					let [err, data] = res
					if (data.data.code == 200) {
						uni.showToast({
							title: '成功！',
							
						});
					} else {
						uni.showToast({
							title: '失败！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			
			//颁发证书
			iName: function(e) {
				this.jkn = e.detail.value
				console.log(this.jkn)
			},
			jName: function(e) {
				this.psn = e.detail.value
				console.log(this.psn)
			},
			tName: function(e) {
				this.fdn = e.detail.value
				console.log(this.fdn)
			},
			sPhone: function(e) {
				this.snum = e.detail.value
				console.log(this.snum)
			},
			banfa() {
				console.log(this.examId)
				console.log(this.snum)
				console.log(this.jkn)
				console.log(this.psn)
				console.log(this.fdn)
				banfaCerfict({
					"examId": this.examId,
					"invigilator": this.jkn,
					"judgeThacher": this.psn,
					"tutor": this.fdn,
					"phone": this.snum
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					if (data.data.code == 200) {
						uni.showToast({
							title: '颁发成功！',
							icon: 'success'
						});
					} else {
						uni.showToast({
							title: '颁发失败！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			//增加项目
			gradeType: function(e) {
				console.log("数字"+JSON.stringify(e))
				this.gradeTypeInfo = parseInt(e.detail.value)+1 
				this.n = e.detail.value
				console.log("数字"+this.gradeTypeInfo)
			},
			// gruopCode: function(e) {
			// 	this.gruopCodeInfo = e.detail.value
			// },
			isGroup: function(e) {
				this.isGroupInfo = parseInt(e.detail.value) + 1
				this.m = e.detail.value
				console.log("数字" + this.isGroupInfo)
			},
			name: function(e) {
				this.nameInfo = e.detail.value
			},
			wancheng() {
				pProjects({
					"competitionId": this.comptionId,
					"gradeType": this.gradeTypeInfo,
					"gruopCode": this.gruopCodeInfo,
					"isGroup": this.isGroupInfo,
					"name": this.nameInfo
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					if (data.data.code == 200) {
						uni.showToast({
							title: '添加成功！',
							icon: 'success'
						});
						uni.redirectTo({
							url:'./houtai'
						})
					} else {
						uni.showToast({
							title: '添加失败！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			//配置单个题目分数
			pickerChange: function(e) {
				this.index = e.detail.value
				this.questionId = this.qList[this.index].id
			},
			ss: function(e) {
				this.score = e.detail.value
			},
			sscore() {
				if (this.questionId == '') {
					uni.showToast({
						title: '请点击选择考试题目！',
						image: '../../static/gantan.png'
					});
					return
				}
				singleScore({
					"questionId": this.questionId,
					"score": this.score
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					if (data.data.code == 200) {
						uni.showToast({
							title: '修改成功！',
							icon: 'success'
						});
					} else {
						uni.showToast({
							title: '修改失败！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			//配置整个题库考试题目分数
			bankNum: function(e) {
				this.bankId = e.detail.value
			},
			allScore: function(e) {
				this.aScore = e.detail.value
			},
			complete() {
				cAllScore({
					"bankId": this.bankId,
					"score": this.aScore
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					if (data.data.code == 200) {
						uni.showToast({
							title: '修改成功！',
							icon: 'success'
						});
					} else {
						uni.showToast({
							title: data.data.message,
							image: '../../static/gantan.png'
						});
					}
				})
			},
			//查询考试配置
			// queryEp(){
			// 	console.log("ok")
			// 	uni.navigateTo({
			// 		url:'../queryExamConfig/queryExamConfig'
			// 	})
			// },
			//增加题目
			pQuestion(data) {
				console.log("增加的题目为" + data)
				console.log(JSON.parse(data).questionResult)
				if( JSON.parse(data).questionResult=="" ||
				JSON.parse(data).questionNum=="" ||
				JSON.parse(data).questionOption=="" ||
				JSON.parse(data).questionScore=="" ||
				JSON.parse(data).questiontitle==""){
					uni.showToast({
						title: '参数不能为空！',
						image: '../../static/gantan.png'
					});
					return;
				}
				pQuestionList({
					"answer": JSON.parse(data).questionResult,
					"bankId": JSON.parse(data).questionNum,
					"option": JSON.parse(data).questionOption,
					"score": JSON.parse(data).questionScore,
					"stem": JSON.parse(data).questiontitle
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					if (data.data.code == 200) {
						uni.showToast({
							title: '添加成功！',
							icon: 'success'
						});
					} else {
						uni.showToast({
							title: '添加失败！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			//查询题库
			number: function(e) {
				console.log(e.detail.value)
				//获得设置的考试题目数量
				this.count = e.detail.value
				this.bankId = e.detail.value
				console.log("bankId为：" + this.bankId)
				questionBank({
					"bankId": this.bankId
				}).then((res) => {
					let [err, data] = res
					console.log(data.data.data)
					//获得所有题目
					this.qList = data.data.data
				})
			},
			//增加考题数量
			pCount() {
				if (this.examId == '') {
					uni.showToast({
						title: '请点击选择考试项目！',
						image: '../../static/gantan.png'
					});
					return
				}
				configNum({
					"examId": this.examId,
					"number": this.count
				}).then((res) => {
					let [err, data] = res
					console.log(data.data.data)
					if (data.data.code == 200) {
						uni.showToast({
							title: '配置成功！',
							icon: 'success'
						});
					}else{
						uni.showToast({
							title: '配置失败！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			//查询题库
			query() {
				uni.navigateTo({
					url: '../tiku/tiku?bankId=' + this.bankId
				})
			},
			//删除等级考试
			comList(data) {
				this.isShow = true
				console.log('索引为：' + data)
				console.log(typeof(data))
				console.log('比赛id为：' + this.matchList[data].id)
				projects({
					"competitionId": this.matchList[data].id
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					this.projectList = data.data.data
				})
			},
			bindPickerChange: function(e) {
				this.index = e.detail.value
				this.examId = this.examList[this.index].id

			},
			bindPicker: function(e) {
				this.index = e.detail.value
				this.comptionId = this.matchList[this.index].id
				console.log(this.comptionId)
			},
			bindChange: function(e) {
				this.index = e.detail.value
				this.questionId = this.qList[this.index].id
			},
			bps: function(e) {
				this.index = e.detail.value
				console.log("数据：" + e.detail.value)
				this.projectsId = this.projectList[this.index].id
				console.log("数据id：" + this.projectsId)
			},
			groupT: function(e) {
				console.log("组别为：" + e.detail.value)
				this.o = e.detail.value
				switch (e.detail.value) {
					case "0":
						this.groupTNum = 'XIAOXUE';
						break;
					case "1":
						this.groupTNum = 'CHUZHONG';
						break;
					case "2":
						this.groupTNum = 'GAOZHONG';
						break;
					case "3":
						this.groupTNum = 'DAXUE';
						break;
					case "4":
						this.groupTNum = 'FUJIA';
						break;
				}
				console.log("组别为：" + this.groupTNum)
			},
			xiazai() {
				this.flag = true
				gradeUrl({
					"competitionId": this.comptionId,
					"projectId": this.projectsId,
					"groupTypeEnum": this.groupTNum
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					this.gUrl = data.data.data
					if (data.data.code == 200) {
						uni.showToast({
							title: '打开浏览器下载'
						})
					}
				})
			},
			shanchu() {
				if (this.projectsId == '') {
					uni.showToast({
						title: '请点击选择比赛和项目！',
						image: '../../static/gantan.png'
					});
					return
				}
				deleteProjectsList({
					"id": this.projectsId
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					if (data.data.code == 200) {
						this.projectList.splice(this.index, 1)
						uni.showToast({
							title: '删除成功！',
							icon: 'success'
						});
					} else {
						uni.showToast({
							title: '删除失败！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			//删除题库的题目
			dq() {
				if (this.questionId == '') {
					uni.showToast({
						title: '请点击选择题目！',
						image: '../../static/gantan.png'
					});
					return
				}
				deleteQuestion({
					"questionId": this.questionId
				}).then((res) => {
					let [err, data] = res
					console.log("删除题目：" + data)
					if (data.data.code == 200) {
						this.qList.splice(this.index, 1)
						uni.showToast({
							title: '删除成功！',
							icon: 'success'
						});
					} else {
						uni.showToast({
							title: '删除失败！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			getExamFromSon(data) {
				console.log(data)
				this.examList.splice(JSON.parse(data).index, 1)
				// this.examList.splice(data.index, 1)
				deleteExamj({
					"id": JSON.parse(data).id
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					if (data.data.code == 200) {
						uni.showToast({
							title: '删除成功！',
							icon: 'success'
						});

					} else {
						uni.showToast({
							title: '删除失败！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			plusLeaveExamList(data) {
				console.log(data)
				plusExam({
					"leave": JSON.parse(data).examleaveList,
					"number": JSON.parse(data).exampayList,
					"scheduling": JSON.parse(data).examschedulingList,
					"startTime": JSON.parse(data).time1,
					"title": JSON.parse(data).examtitleList,
					"upToDate": JSON.parse(data).dateList2,
					"endTime": JSON.parse(data).endTime,
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					if (data.data.code == 200) {
						uni.showToast({
							title: '添加成功！',
							icon: 'none'
						});
						uni.redirectTo({
							url:'./houtai'
						})
					} else {
						uni.showToast({
							title: '添加失败！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			//下载大赛报名表
			dbaoming(id) {
				this.isLook = true
				downloadSign({
					"competitionId": id
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					this.url = data.data.data
					
					if (data.data.code == 200) {
						uni.showToast({
							title: '打开浏览器下载'
						})
					}
				})
			},
			//下载等级考试报名结果
			dresult(id) {
				this.isLook = true
				signResult({
					"examId": id
				}).then((res) => {
					let [err, data] = res
					this.rurl = data.data.data
					if (data.data.code == 200) {
						uni.showToast({
							title: '打开浏览器下载'
						})
					}
				})
			},
			//下载等级考试报名表
			download(id) {
				this.isLook = true
				signTable({
					"examId": id
				}).then((res) => {
					let [err, data] = res
					this.turl = data.data.data
					if (data.data.code == 200) {
						uni.showToast({
							title: '打开浏览器下载'
						})
					}
				})
			},
			//生成证书
			getCertificalFromSon(data) {
				console.log(data)
				getCertificalList({
					"competitionId": JSON.parse(data).id
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					if (data.data.code == 200) {
						uni.showToast({
							title: '证书已生成！',
							icon: 'success'
						});
					} else if (data.data.code == 1011004006) {
						uni.showToast({
							title: '考试已关闭！',
							image: '../../static/gantan.png'
						});
					} else {
						uni.showToast({
							title: '生成证书失败！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			//关闭考试
			getExamListfromSon(data) {
				this.examList.splice(JSON.parse(data).index, 1)
				closeExamList({
					'examId': JSON.parse(data).id
				}).then((res) => {
					let [err, data] = res
					if (data.data.code == 200) {
						uni.showToast({
							title: '考试已关闭！',
							icon: 'success'
						});
					} else {
						uni.showToast({
							title: '考试关闭失败！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			//删除大赛通知
			getNoticeListfromSon(data) {
				this.noticeList.splice(JSON.parse(data).index, 1)
				deleteNoticeList({
					"id": JSON.parse(data).id
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					if (data.data.code == 200) {
						uni.showToast({
							title: '删除成功！',
							icon: 'success'
						});
					} else {
						uni.showToast({
							title: '删除失败！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			//修改管理员通知
			getMnoticeListfromSon(data) {
				console.log("传递的内容：" + data)
				// 传递的内容：{"noticeId":6,"noticeContent":"管理员备注"}
				console.log("传递的内容：" + JSON.parse(data).noticeContent)
				console.log("传递的内容：" + JSON.parse(data).noticeId)
				console.log("传递的内容：" + JSON.parse(data).type)
				updataNotice({
					"content": JSON.parse(data).noticeContent,
					"noticeId": JSON.parse(data).noticeId
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					if (data.data.code == 200) {
						uni.showToast({
							title: '修改成功！',
							icon: 'success',
							duration: 3000
						})
						notice({
							"type": "2"
						}).then((res) => {
							let [err, data] = res
							console.log("管理员备注" + data.data.data)
							this.mnoticeListM = data.data.data
						})
						notice({
							"type": "3"
						}).then((res) => {
							let [err, data] = res
							console.log("管理员备注" + data.data.data)
							this.mnoticeListM.push(data.data.data[0])
						})
					}
				})
				// this.noticeListM.splice(JSON.parse(data).index, 1)
				// deleteNoticeList({
				// 	"id":JSON.parse(data).id
				// }).then((res)=>{
				// 	let [err,data] = res
				// 	console.log(data)
				// 	if(data.data.code == 200){
				// 		uni.showToast({
				// 			title: '删除成功！',
				// 			icon:'success'
				// 		});
				// 	}else{
				// 		uni.showToast({
				// 			title: '删除失败！',
				// 			image:'../../static/gantan.png'
				// 		});
				// 	}
				// })
			},
			//删除大赛
			delectMatchFromSon(data) {
				this.matchList.splice(JSON.parse(data).index, 1)
				this.matchId = JSON.parse(data).id
				console.log('id')
				console.log(this.matchId)
				delectMatchList({
					id: this.matchId
				}).then((res) => {
					let [err, data] = res
					console.log(this.matchId)
					console.log(data)
					if (data.data.code == 200) {
						uni.showToast({
							title: '删除成功！',
							icon: 'success'
						});
					} else {
						uni.showToast({
							title: '删除失败！',
							image: '../../static/gantan.png'
						});
					}
				})

			},
			//增加大赛
			getMatchfromSon(data) {
				console.log("大赛信息为：" + typeof(data))
				console.log("imageUrl：" + data.msgFormSon)
				plusMatchList({
					"imageUrl": JSON.parse(data).msgFormSon,
					"title": JSON.parse(data).m_name,
					"update": JSON.parse(data).dateList2,
					"startTime":JSON.parse(data).startTime
				}).then((res) => {
					let [err, data] = res
					console.log(data)
					if (data.data.code == 200) {
						// this.matchList.unshift()
						uni.showToast({
							title: '大赛添加成功！',
							icon: 'success'
						});
						uni.redirectTo({
							url: './houtai'
						});
					} else {
						uni.showToast({
							title: '请上传大赛图片和标题！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			//增加首页大赛通知
			getNoticefromSon(data) {
				console.log('增加全国大赛通知')
				console.log(data)
				// console.log(JSON.parse(data).noticesfromSon.join())
				// console.log(data)
				// console.log(data.noticesfromSon)
				plus_notice({
					"content": JSON.parse(data).noticesinfo,
					"imageUrl": JSON.parse(data).noticesfromSon,
					"title": JSON.parse(data).noticeTitle,
					"type": "1",
					"oneImage":JSON.parse(data).oneImage,
					"twoImage":JSON.parse(data).twoImage
				}).then((res) => {
					let [err, data] = res
					if (data.data.code == 200) {
						uni.showToast({
							title: '通知添加成功！',
							icon: 'none'
						});
						uni.redirectTo({
							url:'./houtai'
						})
					} else {
						uni.showToast({
							title: '请上传通知的图片、内容和标题！',
							image: '../../static/gantan.png'
						});
					}
				})
			},
			//增加管理员通知
			// getMnoticefromSon(data){
			// 	console.log("管理员通知为："+data)
			// console.log("管理员通知为："+typeof(data))
			// console.log(JSON.parse(data).noticesfromSon.join())
			// 	plus_notice({
			// 		"content":JSON.parse(data).noticesinfo,
			// 		"title":JSON.parse(data).noticeTitle,
			// 		"type":"2"
			// 	}).then((res)=>{
			// 		let [err,data] = res
			// 		console.log(data)
			// 		if(data.data.code == 200){
			// 			uni.showToast({
			// 				title: '通知添加成功！',
			// 				icon:'success'
			// 			});
			// 		}else{
			// 			uni.showToast({
			// 				title: '添加失败！',
			// 				image:'../../static/gantan.png'
			// 			});
			// 		}
			// 	})
			// },
		},
		components: {
			uniCollapse,
			uniCollapseItem,
			uniSection,
			uniSwipeAction,
			uniSwipeActionItem,
			tupian,
			plusNotice,
			plusMatch,
			delectMatch,
			deleteNotice,
			closeExam,
			getCertifical,
			plusLeaveExam,
			deleteExam,
			deleteProjects,
			plusQuestion
		},
	}
</script>

<style lang="scss" scoped>
	view {
		width: 100%;
		font-size: 14px;
		text-align: left;
		background-color: #fff;
		line-height: 40px;

		button {
			font-size: 12px;
			background-color: #CCE6FF;
			margin: 10px auto;
		}

		input {
			width: 60%;
			border: 2px solid #CCE6FF;
			font-size: 12px;
			margin: 5px auto;
			text-align: center;
			height: 35px;
		}

		.cont {
			flex: 1;
			height: 45px;
			line-height: 45px;
			padding: 0 15px;
			position: relative;
			background-color: #fff;
			font-size: 15px;
			border-bottom-color: #F0F0F0;
			border-bottom-width: 2px;
			border-bottom-style: solid;
		}

		.big {
			background-color: #eeeeef;
			font-size: 20px;
			font-weight: 900;
		}
	}
</style>
